<?php

namespace app\model;
use app\util\Tools;
class TaskComplete extends Base
{
    protected $autoWriteTimestamp = true;
    protected $resultSetType = 'collection';
    protected $updateTime = 'updateTime';
    protected $createTime = 'addTime';



    public function getStatusTextAttr($value, $data) {
        $status = ['-1' => '审核中','1' => '通过', '2' => '驳回', '9' => '取消'];
        return isset($status[$data['status']])?$status[$data['status']]:'未知';
    }

    public function getOpData(){
        return $this->hasOne('fresh_admin_user','opMid','id')->field('id, username as opUsername');
    }

    public function getCheckData(){
        return $this->hasOne('fresh_admin_user','checkMid','id')->field('id, username as opUsername');
    }

    public function getcheckTimeTextAttr($value, $data) {
        return isset($data['checkTime'])?date('Y-m-d H:i:s', $data['checkTime']):'';
    }

    public function getTask(){
        return $this->hasOne('task','taskID','taskID')->field('taskID, title as taskTitle');
    }



}
